﻿using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Sino.CapacityCloud.Services
{

    public interface IAzureStorageService
    {

        Task<string> GenerateShareAccessSignitureAsync(string containerName, SharedAccessBlobPermissions permittion = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write, DateTime? startTime = null, DateTime? expiryTime = null);

        Task<bool> RemoveContainerAsync(string containerName);

        Task<IEnumerable<IListBlobItem>> GetContainerBlobListAsync(string sas, string prefix = "");

        Task<bool> BlobItemExistsAsync(string sas, string fileName);

        Task<string> GetBlobItemUriAsync(string sas, string fileName, bool withSas = false, string policyName = null, SharedAccessBlobPermissions permittion = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write, DateTime? startTime = null, DateTime? expiryTime = null);

        Task ReadBlobAsync(string sas, string fileName, Stream target);

        Task ReadBlobAsync(string sas, string fileName, Stream target, CancellationToken token);

        Task<string> UploadBlobAsync(string sas, string fileName, Stream source, bool overwritten = true, string policyName = null, SharedAccessBlobPermissions permittion = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write, DateTime? startTime = null, DateTime? expiryTime = null);

    }

}